

#ifndef xm_cache_hpp
#define xm_cache_hpp

#include <stdio.h>
#include <stdint.h>

#define IS_KEY_FRAME 1

typedef struct xmcache_st * xmcache_t;

xmcache_t xmcache_create(int max_caches, int is_alloc_buf);

void xmcache_delete(xmcache_t obj);

int xmcache_put_rtp(xmcache_t obj, uint32_t seq, int is_key_frame, int codec, const unsigned char * buf, int length);

int xmcache_pull_rtp(xmcache_t obj, uint32_t seq, const unsigned char ** pbuf, int *plength);

int xmcache_pull_rtp_range(xmcache_t obj, int64_t now, int64_t max_time
                           , uint16_t orig_pid, uint16_t orig_blp
                           , uint16_t * pnew_pid, uint16_t * pnew_blp, uint32_t * pskip_num
                           , unsigned char ** pbuf, int * plengths, int * pcodecs, int *pnum);

int xmcache_req_range(xmcache_t obj, int64_t now, int64_t max_time
                       , uint16_t orig_pid, uint16_t orig_blp
                       , uint16_t * pnew_pid, uint16_t * pnew_blp
                       , uint32_t * pskip_num
                       , int *pnum);

//int64_t xmcache_get_and_set_req_time(xmcache_t obj, uint32_t seq, int64_t req_time);


#endif /* xm_cache_hpp */
